/***********************************************
 * Title:       WelcomeAction.java
 * Description: WelcomeAction.java
 * Author:      NiDeveloper
 * Create Date: 2010-6-1
 * CopyRight:   CopyRight(c)@2009
 * Company:     TJUSCS
 * Version:     1.0
 ***********************************************
 */
package edu.tju.publicModule;

import org.infohazard.maverick.ctl.FormBeanUser;
import org.infohazard.maverick.flow.ControllerContext;

import com.younker.waf.core.user.User;
import com.younker.waf.core.user.UserService;

import edu.tju.teacherManagement.Teacher;
import edu.tju.teacherManagement.TeacherService;


/**
 * @author NiDeveloper
 *
 */
public class WelcomeAction extends FormBeanUser
{
        
        private String teacherName;
        private String userName;

        /* (non-Javadoc)
         * @see org.infohazard.maverick.ctl.FormBeanUser#makeFormBean(org.infohazard.maverick.flow.ControllerContext)
         */
        @Override
        protected Object makeFormBean(ControllerContext arg0)
        {
                return new WelcomeAction();
        }

        /* (non-Javadoc)
         * @see org.infohazard.maverick.ctl.FormBeanUser#perform(java.lang.Object, org.infohazard.maverick.flow.ControllerContext)
         */
        @Override
        protected String perform(Object beans, ControllerContext ctx) throws Exception
        {
                WelcomeAction bean = (WelcomeAction)beans;
                Teacher teacher = TeacherService.getInstance().getCurrentTeacher(ctx);
                User user = UserService.getInstance().getCurrentUser(ctx);
                bean.setUserName(user.getLoginName());
                bean.setTeacherName(teacher.getName());
                return SUCCESS;
        }

        /**
         * @return the teacherName
         */
        public String getTeacherName()
        {
                return teacherName;
        }

        /**
         * @param teacherName the teacherName to set
         */
        public void setTeacherName(String teacherName)
        {
                this.teacherName = teacherName;
        }

        /**
         * @return the userName
         */
        public String getUserName()
        {
                return userName;
        }

        /**
         * @param userName the userName to set
         */
        public void setUserName(String userName)
        {
                this.userName = userName;
        }
        
        
        
        

}
